<template>
	<view>
		<uni-rate class="flex-center" :touchable="false" size="40" v-model="data.benefitScores" @change="onChange" />
		<view class="flex-center">
			<textarea placeholder="请输入评价内容" v-model="data.comment"></textarea>
		</view>
		<button class="btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import requestHttp from '@/providers/essential/httpService.js'
	export default {
		data() {
			return {
				data: {},
				userInfo: {},
			}
		},
		methods: {
			submit() {
				requestHttp.postData('/app-api/pz/service-manage-comment/create', {
					serviceManageId: 3,
					userId: 1,
					nickName: this.userInfo.nickname,
					userAvatar: this.userInfo.avatar,
					benefitScores: this.data.benefitScores,
					content: this.data.comment,
				}).then((res) => {
					console.log(res)
				})
				// requestHttp.deleteData('app-api/pz/service-manage-comment/delete?id=5',)
			},
		},
		onLoad() {
			this.userInfo = uni.getStorageSync('userInfo')
			console.log(this.userInfo)
			this.data.benefitScores=5
		}
	}
</script>

<style>
	.flex-center {
		display: flex;
		justify-content: center;
		margin-top: 10rpx;
	}

	textarea {
		background-color: #fafafa;
		padding: 20rpx;
		border-radius: 30rpx;
	}

	.btn {
		margin-top: 20rpx;
		width: 300rpx;
		background-color: #0aba94;
		color: white;
		padding: 1rpx 20rpx 1rpx 20rpx;
		border-radius: 100rpx;
	}
</style>